import numpy as np

# 创建多维数组
arr = np.array([[1, 2, 3], [4, 5, 6]])

print(arr)

print(arr[0][1])

print(arr[::, 1])

arr = np.array([[1, 2, 3], [4, 5, 6]])

print(arr > 2)

# 取出大于的数据
# 布尔值索引
print(arr[arr > 2])

arr = np.array([[1, 2, 3], [4, 5, 6]])
print(arr)

arr2 = arr.reshape((3, 2))
print(arr2)

arr = np.array([[1, 2, 3], [4, 5, 6]])
arr2 = np.array([[1, 2, 3], [4, 5, 6]])

print(np.hstack((arr, arr2)))

arr = np.array([[1, 2, 3], [4, 5, 6]])

print(arr.T)

print(np.fliplr(arr))
print(np.flipud(arr))

arr = np.array([[1, 2, 3], [4, 5, 6]])
arr2 = np.array([[1, 2, 3], [4, 5, 6]])

# 对位运算
print(arr + arr2)
print(arr - arr2)
print(arr * arr2)
print(arr / arr2)

# 矩阵相乘

arr = np.array([[1, 2, 3], [4, 5, 6]])
arr2 = np.array([[1, 2], [3, 4], [5, 6]])

print(arr.dot(arr2))

arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])

print(np.log10(arr))

arr = np.array([[1, 2, 3], [4, 5, 6]])

print(arr)
print(np.diff(arr, axis=1))

print(np.amin(arr, axis=0))

print(np.random.normal(size=(2, 3)))
